﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ITAP.ContourBuilder.Manipulation;

namespace ITAP.ContourBuilder.GUI
{
    public partial class ExecutableToolStrip : ToolStrip
    {
        private ContourControl contourControl;

        public ContourControl ContourControl
        {
            get { return contourControl; }
            set { contourControl = value; }
        }

        public ExecutableToolStrip()
        {
            InitializeComponent();
        }

        public ExecutableToolStrip(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        internal void ToolStripItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            foreach (ToolStripButton item in this.Items)
                item.Checked = false;

            (e.ClickedItem as ToolStripButton).Checked = true;
            GlobalData.ExecuteManager.Execute(e.ClickedItem.Tag as IExecutable);
        }

        internal void Manipulator_CommandExecuted(ICommand command)
        {
            foreach (ToolStripButton item in this.Items)
                item.Checked = false;
        }
    }
}
